home *** CD-ROM | disk | FTP | other *** search
- Path: castle.nando.net!news
- From: actuary@nando.net (Bill McCarthy)
- Newsgroups: comp.lang.c
- Subject: Re: char* to char array[] ?
- Date: 17 Jan 1996 02:23:26 GMT
- Organization: News & Observer Public Access
- Message-ID: <4dhmiu$nu0@castle.nando.net>
- References: <4d4n9s$9uv@ixnews2.ix.netcom.com> <1996Jan13.013852.19365@hns.com>
- Reply-To: actuary@nando.net (Bill McCarthy)
- NNTP-Posting-Host: vyger609.nando.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <1996Jan13.013852.19365@hns.com>, Ralph Sweitzer <t_rsweitzer> writes:
- >Try something like this it should work.
- >
- >/* prototype */
- >char *called_finction(void);
-
- The above prototyped function is never used ???
-
- >void calling_function(void)
- >{
- > char *ptr;
- > ptr = called_function();
-
- The above function should be prototyped before use.
-
- >}
- >
- >char *called_function(void)
- >{
- > char buf[] = {"hello world"};
-
- If you don't make the above static, you'll end returning
- a pointer to freed memory.
-
- > return((char *)buf);
- >}
-
- Bill McCarthy
- actuary@nando.net
- Wendell, NC USA
-
-